/*-------------------<-- Start of Description-->---------------------\ | Retrieve the last word in a string; | |---------------------<-- End of Description-->----------------------| |--------------------------------------------------------------------| |-----------<-- Start of Files or Arguements Needed-->---------------| | Arguments: | | _arg1_ - the string; | | dlm - the delimiter; | |------------<-- End of Files or Arguements Needed-->----------------| |--------------------------------------------------------------------| |------------------<-- Start of Files Created-->---------------------| | Example: | | %let list=a b c d e\6; | | %put LIST=&list TAIL=%tail(&list); | | %put LIST=&list TAIL=%tail(&list, split=\ | | %put %tail((a b c (de) 6), dlm=%str(())); | | Usage: %tail(_arg1_, dlm=%str( )); | \------------------<-- Start of Files Created-->--------------------*/ %macro tail(_arg1_, dlm=%str( )); /*--------------------------------------------\ | Copy Right: Duo Zhou; | | Created: 12-28-2001 8:10pm; | \--------------------------------------------*/ %if (%index(%BQUOTE(%trim(%BQUOTE(%left(%BQUOTE(&_arg1_))))), %str(%()) eq 1) and (%index(%BQUOTE(%trim(%BQUOTE(%left(%BQUOTE(%sysfunc(reverse(&_arg1_))))))), %str(%))) eq 1) %then %let _arg1_=%substr(%quote(%trim(%quote(%left(%quote(&_arg1_))))), 2, %eval(%length(%trim(%quote(%left(%quote(&_arg1_)))))-2)); %sysfunc(reverse(%nrbquote(%qscan(%nrbquote(%sysfunc(reverse(%nrbquote(&_arg1_)))),1, %nrbquote(&dlm))))); %mend tail;